package com.yll.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yll.dao.StudentDao;
import com.yll.domain.Student;
import com.yll.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentDao studentDao;

    @Override
    public boolean save(Student student) {
        return studentDao.save(student);
    }

    @Override
    public boolean update(Student student) {
        return studentDao.update(student);
    }

    @Override
    public boolean delete(Integer id) {
        return studentDao.delete(id);
    }

    @Override
    public Student findById(Integer id) {
        return studentDao.findById(id);
    }

    @Override
    public PageInfo<Student> findAll(int page, int size) {
        PageHelper.startPage(page,size);
        List<Student> list = studentDao.findAll();
        return new PageInfo(list,5);
    }
}
